package com.guonl.controller;

import com.alibaba.fastjson.JSONObject;
import com.guonl.annotations.SignatureValidation;
import com.guonl.open.api.response.OpenApiResult;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Api(tags = "验签测试类")
@Validated
@RestController
@RequestMapping("/oauth/v1/demo")
public class SignDemoController {

    @SignatureValidation
    @GetMapping("/getTest")
    public OpenApiResult getTest1(String name, Integer age, String phone) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("name", name);
        jsonObject.put("age", age);
        jsonObject.put("phone", phone);
        return OpenApiResult.ok(jsonObject);
    }

    @SignatureValidation
    @PostMapping("/postTest")
    public OpenApiResult postTest2(@RequestBody JSONObject map) {
        return OpenApiResult.ok(map);
    }


}
